<?php


namespace app\admin\controller\intention;


use app\common\controller\Adminbase;
use think\Db;

class Intention extends Adminbase
{
    protected $searchFields = 'name,phone';

    public function index()
    {
        if ($this->request->isAjax()) {
            list($page, $limit, $where) = $this->buildTableParames();
            $_list = Db::name('intention')
                ->where($where)
                ->order('create_time desc')
                ->page($page, $limit)
                ->select();
            foreach ($_list as $k=>$v){
                $_list[$k]['create_time']=date('Y-m-d H:i:s',$v['create_time']);
            }
            $total = Db::name('intention')
                ->where($where)
                ->count();
            $result = array("code" => 0, "count" => $total, "data" => $_list);

            return json($result);

        }
        return $this->fetch();
    }
}